<?php
class loginControl extends Control{
    function index(){
        C("debug",0);
      $this->display("login");
    }
    //接受表单里的数据
    function login(){
        $username = $this->_POST("username");
            $password = $this->_POST("password");
            C("user_table","zt_user");#用户表
        //print_r($_POST);
        //验证验证码是否正确
 //       if(strtolower($_POST['code'])!=  strtolower($_SESSION['code'])){
  //          $this->error("验证码不正确","login/index"); 
 //       }
        if(Rbac::login($username,$password)){
            go("index/index");
        }  else {
            $this->error($this->error,"index");    
        }
    }
    //退出登录
    function logout(){
       // unset($_SESSION['user']);
        session_destroy();
        $this->go("login/index");
    }
    
    //验证码
    function code(){
        $code=new code();
        $code->show();
    }
    
    
    
    
    
    
    
    
    
}